import 'dart:math';

import 'package:flutter/material.dart';
import 'package:ost_flutter_module/class/store/course_page/widgets/store_course_home_card.dart';
import 'package:ost_flutter_module/common/adapt.dart';
import 'package:ost_flutter_module/common/color.dart';
import 'package:ost_flutter_module/common/styles.dart';
import 'package:ost_flutter_module/common/utils.dart';
import 'package:ost_flutter_module/widget/custom_widget/custome_section_header.dart';
import 'package:ost_flutter_module/widget/custom_widget/text_button.dart';

class StoreOrderResultPageBody extends StatelessWidget {
  List _list = [
    '1',
    '2',
    '2',
  ];

  @override
  Widget build(BuildContext context) {
    return CustomScrollView(
      slivers: [
        SliverList(
          delegate: SliverChildListDelegate([
            _buildHeader(),
            SizedBox(height: Adapt.px(30)),
            StoreSectionHeaderWidget(text: '为你推荐'),
            ListView.builder(
              shrinkWrap: true,
              physics: NeverScrollableScrollPhysics(),
              itemCount: _list.length,
              itemBuilder: (BuildContext context, int index) {
                return StoreCourseHomeCard(
                  type: CourseCardType.values[Random().nextInt(3)],
                );
              },
            ),
          ]),
        ),
      ],
    );
  }

  Widget _buildHeader() => Padding(
        padding: EdgeInsets.only(top: Adapt.px(30)),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Utils.svgAssets('icon_success'),
            SizedBox(height: Adapt.px(10)),
            Text('支付完成', style: TextStyles.titleStyle),
            SizedBox(height: Adapt.px(30)),
            Center(
              child: Container(
                width: Adapt.px(180),
                height: Adapt.px(36),
                child: GTextButton(
                  title: '查看订单',
                  normalForgroundColor: color42270C,
                  normalBackgroundColor: colorFACD33,
                  radius: 18,
                  onPressed: () {},
                ),
              ),
            ),
          ],
        ),
      );
}
